<template>
    <el-container style="height: 100%">
      <el-aside width="150px" class="my-menu">
        <el-menu
          :default-active="activeComponent"
          @select="handleSelect"
          style="border: 0;"
        >
        <span class="title">管理中心</span>
        <el-divider />
          <el-menu-item index="OrderList"
            ><template #title>
              <el-icon><Tickets /></el-icon>
              <span>订单管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="UserList"
            ><template #title>
              <el-icon><User /></el-icon>
              <span>用户管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="ComplainList"
            ><template #title>
              <el-icon><CopyDocument /></el-icon>
              <span>投诉管理</span>
            </template>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <div class="main-content">
          <component :is="components[activeComponent]" />
        </div>
      </el-main>
    </el-container>
  </template>
  <script setup>
  import { ref } from "vue";
  import OrderList from "./OrderList.vue";
  import UserList from "./User.vue";
  import Complain from "./Complain.vue";
  const activeComponent = ref("OrderList");
  const handleSelect = (key) => {
    activeComponent.value = key;
  };
  const components = {
    OrderList: OrderList,
    UserList: UserList,
    ComplainList: Complain,
  };
  </script>
  
  <style scoped>
  .el-container {
    display: flex;
    flex-direction: row;
  }
  .title {
    font-size: 20px;
    font-weight: bold;
    display: block;
    text-align: center;
    margin-top: 20px;
  }
  .my-menu {
    height: 100vh;
    border: 0;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
  .el-main {
    flex: 1;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    margin: 0 20px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
    overflow-y: auto;
  }
  </style>
  